# encoding=utf-8
# author:梁子龙

from flask import Blueprint
from flask_restful import Api
from comment.utils.output import output_json
# 加载当前蓝图中的所有资源
from asys_main.resource.user.user_resource import *

user_bp = Blueprint('user', __name__, url_prefix='/api/user')  # 创建蓝图
user_api = Api(user_bp)

# 使用定制好的返回到前端的json格式
user_api.representation('application/json')(output_json)

user_api.add_resource(Login, '/login', endpoint='login')  # 登录的资源
user_api.add_resource(LoginOut, '/logout', endpoint='loginOut')  # 退出登录
user_api.add_resource(CurrentUser, '/currentUser', endpoint='current_user')
user_api.add_resource(AllUser, '/user', endpoint='user')
user_api.add_resource(RegisterUser, '/register', endpoint='register')  # 用户注册
user_api.add_resource(Password, '/password', endpoint='password')
user_api.add_resource(UserCode, '/code', endpoint='code')
user_api.add_resource(PersonInfo, '/userinfo', endpoint='userinfo')
